package com.ctshk.sapp.stamp;

import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.net.URL;

@SpringBootApplication
@EnableDiscoveryClient
@ComponentScan("com.ctshk")
public class SappStampApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SappStampApplication.class, args);
       /* //SpringApplication.run(SappStampApplication.class, args);
        Map<String, String> parament = new HashMap<>();
        parament.put("API_KEY", "4AF69E5B01294F2C95E8BBFB63862009");//旅行社的API密钥。应该是通过在线功能生成/重新生成
        parament.put("RECEIPT_NUMBER", "222222222222");//收据号码,每个E-Frank记录都是唯一的。
        parament.put("OUT_BOUND_FA", "12");//小数的值最多有2位小数是
        parament.put("NAME_OF_TRAV_ELER_PAYER", "謝濤");//旅行者/付款人或公司的名称，以中文或简体中文中文或英文。编码应该是UTF-8。
        parament.put("DEPARTURE_DATE", "2021-03-09");//出发日期为YYYY-MM-DD格式。
        parament.put("LAST_4_DIGIT_OF_CONTACT_PHONE_NUMBER", "1234");//联系电话号码最后4位数字的4位数值
        String bodyStr = JSON.toJSONString(parament);

       // String result = HttpUtils.sendHttpSslPost("https://www.elevy-ticf-train.org.hk:8443/SI-EFRANK-WS-01", bodyStr);
        //String result = HttpUtils.sendHttpSslPost("https://www.elevy-ticf-train.org.hk/CTS-API_CTSHK-TICF", bodyStr);
        //System.out.println("+======"+result);*/

        ///----------------------------------------
        /*Service service = new Service();
        Call call;
        String returnvalue = "";

        call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL("http://127.0.0.1:9090/ELevyService.wsdl"));
        //设置operation 名称，
        call.setOperationName(new QName("http://127.0.0.1:9090/ELevyService.wsdl", "ELevy.Service"));
        call.addParameter("API_KEY", Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("RECEIPT_NUMBER", Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("OUT_BOUND_FARE_PAID", Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("NAME_OF_TRAVELER_PAYER", Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("DEPARTURE_DATE", Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("LAST_4_DIGIT_OF_CONTACT_PHONE_NUMBER", Constants.XSD_STRING, ParameterMode.IN);
        //设置返回类型为对象数组
        call.setReturnClass(Object[].class);
        Object[] objs = (Object[]) call.invoke(new Object[]{"4AF69E5B01294F2C95E8BBFB63862009", "222222222222", "12", "謝濤", "2021-03-09", "1234"});

        //System.out.println("objs="+objs);

        System.out.println((String) objs[0]);
        System.out.println((String) objs[1]);
        returnvalue = (String) objs[0];

        String result = (String) objs[2];

        System.out.println("result=" + result);*/
    }


}
